//
//  ShopPayViewController.m
//  jianpai
//
//  Created by yrapp on 16/2/2.
//  Copyright © 2016年 yrapp. All rights reserved.
//

#import "ShopPayViewController.h"
#import "PayWayView.h"
@interface ShopPayViewController ()
@property (nonatomic,strong)PayWayView *payView;
@property (nonatomic,strong)NSString *payStyle;
@end

@implementation ShopPayViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self addView];
    // Do any additional setup after loading the view.
}

- (void)addView {
    
    self.payStyle = nil;
    self.payView = [[PayWayView alloc] initWithFrame:CGRectMake(0, 64, kWidth, kHeight)];
    self.payView.backgroundColor = [UIColor colorWithRed:234.0/255 green:234.0/255 blue:234.0/255 alpha:234.0/255];
    [self.view addSubview:self.payView];
    
    [self.payView.weixinButton addTarget:self action:@selector(weixinButton) forControlEvents:(UIControlEventTouchUpInside)];
    [self.payView.AliButton addTarget:self action:@selector(AliButton) forControlEvents:(UIControlEventTouchUpInside)];
    
    [self.payView.sureButton addTarget:self action:@selector(sureButton) forControlEvents:(UIControlEventTouchUpInside)];
    
    
    
    
}

//选择支付方式
- (void)weixinButton {
    
    [self.payView.weixinButton setImage:[UIImage imageNamed:@"btn_zf_p"] forState:(UIControlStateNormal)];
    [self.payView.AliButton setImage:[UIImage imageNamed:@"btn_zf"] forState:(UIControlStateNormal)];
    
    self.payStyle = @"weixin";
    
    
    
}

- (void)AliButton {
    [self.payView.weixinButton setImage:[UIImage imageNamed:@"btn_zf"] forState:(UIControlStateNormal)];
    [self.payView.AliButton setImage:[UIImage imageNamed:@"btn_zf_p"] forState:(UIControlStateNormal)];
    self.payStyle = @"zhifub";
    
}

//确认支付按钮
- (void)sureButton {
    
    if ([self.payStyle isEqualToString:@"weixin"]) {
        NSLog(@"微信支付");
    }else if([self.payStyle isEqualToString:@"zhifub"]){
        NSLog(@"支付宝支付");
        
    }else {
        NSLog(@"请选择支付方式");
    }
    
    
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
